<div id="focus_<{$widgets_id}>" class="qf-goods-list box3 <{$setting.stylename}>">
<{if $setting.title}><div class="hd"><h3><{$setting.title}></h3></div><{/if}>

<ul class="p-list clearfix">
<{assign var="do" value="1"}>


<{foreach from=$data.goodsRows item=row key=key name=goodsrow}>
	<{capture name=goodstags}><{if $row.tags && $setting.showgoodstag=='on'}><span class="goods-tags">
	<{if $setting.showgoodstagtype =='img'}>
	
	
	<{foreach from=$row.tags item=item key=key name=tags}>
		<{if $item.params.tag_showOnIndex =='on' && $item.params.tag_image}><span style="<{if $item.params.tag_opacity}>
		opacity:<{$item.params.tag_opacity/100}>;filter:alpha(opacity=<{$item.params.tag_opacity}>);<{/if}>" 
		class="img-tag-<{$item.params.pic_loc}>"><img src="<{$data.theme_dir}>/images/i/transparent.gif}>" 
		data-src="<{$item.params.tag_image|storager}>" /></span><{/if}>
	<{/foreach}>

	<{else}>


<{foreach from=$row.tags item=item key=key name=tags}>

	
	<{if $smarty.foreach.tags.iteration 
	
	<= $setting.maxtags|default:'2' && $item.tag_name && $item.params.tag_showOnIndex =='on'}>
	<span class="text-tag-<{$item.params.pic_loc}>" 
	style="<{if $item.tag_fgcolor}>background-color:<{$item.tag_bgcolor}>;<{/if}>
	<{if $item.tag_fgcolor}>color:<{$item.tag_fgcolor}>;<{/if}>
	<{if $item.params.tag_opacity}>opacity:<{$item.params.tag_opacity/100}>;
	filter:alpha(opacity=<{$item.params.tag_opacity}>)<{/if}>">
	<{$item.tag_name}></span><{/if}>
<{/foreach}>


<{/if}>
</span><{/if}><{/capture}><{capture name=goodsImg}>
<a href="<{$row.goodsLink}>" title="<{$row.goodsName}>" target="_blank" class="apic">
<img alt="<{$row.goodsName|escape:html}>" src="<{$data.theme_dir}>/images/i/transparent.gif}>" 
data-src="<{$row.goodsPicM}>"
<{if $setting.resize == 'on'}> width="<{$setting.width}>" height="<{$setting.height}>"<{else}>
 data-img-zoom="true"<{/if}> /></a><{/capture}><{capture name=goodsname}>
 <{if $setting.showgoodsName != "off"}>
 
  <!--add hzk 06-05 provide promotion_data for lxs-->
         <!-- <div style="text-align:center;"> -->
          <!--  <{foreach from=$row.current_promotion.order item=promotion}>
         <div class="dcuxiao"><em class="label-alert"><{$promotion.tag}></em></div>  -->
         <!--  <div><{$promotion.name}></div> -->
    	 <!-- <{/foreach}> -->
 <h3 class="goods-name">
 
 <a href="<{$row.goodsLink}>" 
 title="<{$row.goodsName|escape:html}>" target="_blank"><{$row.goodsName|cut:$setting.maxlength}></a>
 </h3><{/if}><{/capture}><{capture name=goodsIntro}>
 <{if $setting.showgoodsIntro=='on' && $row.goodsIntro}><p class="goods-desc">
 <{$row.goodsIntro|cut:$setting.maxlength1}></p><{/if}><{/capture}>
 <{capture name=goodsinfo}>
 <{if $setting.showbuycount =='on'}><div class="goods-buycount">
 <{if $setting.buycount==1}><span>
 <{$setting.btitle}></span><strong><{$row.goodsBuyCount|default:'0'}></strong><{else}><span><{$setting.btitle}></span><strong>
 <{$row.goodsBuyCountWeek|default:'0'}></strong>
 <{/if}></div>
 <{/if}>
 <{if $setting.show_star =='on'}><div class="goods-comment">
 <{if $row.star.comments_count > 0}><em class="stars stars-<{$row.star.avg_num*10}>"><span class="below"><i class="icon star">&#x2f;</i>
 <i class="icon star">&#x2f;</i><i class="icon star">&#x2f;</i><i class="icon star">&#x2f;</i>
 <i class="icon star">&#x2f;</i></span><span class="above"><i class="icon star">&#x2e;</i><i class="icon star">&#x2e;</i>
 <i class="icon star">&#x2e;</i><i class="icon star">&#x2e;</i><i class="icon star">&#x2e;</i></span></em>
 <a href="<{$row.goodsLink}>#product_comment"><b><{$row.star.comments_count}></b><{t}>条评论<{/t}></a>
 <{else}><{t}>暂无评论<{/t}>
 <{/if}></div>
 <{/if}>
 

 <{if $setting.showgoodsSalePrice == 'on' || $setting.showgoodsMarketPrice == 'on'}>
 
 
 <div class="goods-price">
  <!-- 价格和数量显示 -->
 <{if $data.check_login == 'login'}>
 <!-- <span>AAA</span> -->
 <{if $setting.showgoodsMarketPrice == 'on'}>
 <del class="price"><{$setting.MarketPricetxt}>
 <em><{$row.goodsMarketPrice|cur}></em>
 </del>
 <{/if}>
 
 <{if $setting.showgoodsSalePrice != 'off'}>
 <ins class="price">
 <{$setting.salePricetxt}>
<em>
<!--@zeng 2017.4.25 首页商品列表价格显示控制-->
<{if $row.products.1.info.member_state == '1'}>
<{$row.products.2.mlv_price|cur}>
<{else}>
<{$row.goodsSalePrice|cur}>
<{/if}>
</em>
</ins>
<{/if}>		 
      		
	<!-- <span>BBB</span>	 -->
		<{/if}>
		<!-- 这里是验证--未登录不显示价格 -->	
	
		<!--
          	作者：sihua
          	时间：2017-04-20
          	描述：购物车和数量
        -->
		<div class="goods-buy" style="display: inline-block;float: right;">
          <!-- 加入购物车 -->
          <span class="product-buy-quantity">
	          <span class="item-content">
		          <span class="p-quantity">
		            <a href="javascript:void(0);" class="btn-decrease">-</a><input type="text" 
		             min="<{if $data.add.isused==1}><{$data.add.pernum}><{else}><{$row.peradd}><{/if}>" 
		            max="<{if $row.nostoreSell == 1}>999999999<{else}><{$row.products.0.store|number}><{/if}>" size="2" name="goods[num]" class="action-quantity-input" 
		            value="<{if $data.add.isused==1}><{$data.add.pernum}><{else}><{$row.peradd}><{/if}>"><a href="javascript:void(0);" class="btn-increase">+</a>
		            <span class="p-store" style="float: left;"></span>
		            <input type="hidden" name="stock" value="<{if $row.nostoreSell==0}>{store}<{else}>999999999<{/if}>">
		            
		            <input type="hidden" class="action-quantity-input-getPeradd"  value="<{$row.peradd}>">
		            <input type="hidden"  class="action-quantity-input-havegift"  value="<{$row.products.3.type}>">
			        <input type="hidden"  class="action-quantity-input-getmaxbuy"  value="<{if $row.products.3.type =='havegift'}><{$row.products.4.maxbuy|number}><{else}><{$row.products.0.store|number}><{/if}>">
		          </span>
	          </span>
          </span>
          
          <{if $env.conf.b2c.site.buy.target == '2'}>
          <{assign var='buytarget' value='_blank_cart'}>
          <{elseif $env.conf.b2c.site.buy.target == '3'}>
          <{assign var='buytarget' value='_dialog_minicart'}>
          <{/if}>
          
          <input type="hidden" name="goods[goods_id]" value="<{$row.goodsId}>">
          <input type="hidden" name="goods[product_id]" value="<{$row.products.0.product_id}>">
          <a class="action-addtocart" href="<{link app=b2c ctl=site_cart act=add arg0=goods arg1=$row.goodsId arg2=$row.products.0.product_id arg3=1}>"<{if $buytarget}> target="<{$buytarget}>"<{/if}>><i class="icon">&#x3e;</i></a>
								 
	
        </div>
		<{/if}>

		
		<{if $setting.showgoodsbtn == 'on'}><div class="goods-buy"><a target="_blank" href="<{$row.goodsLink}>" class="btn-buynow"><i class="icon icon-buynow">&#x3e;</i>购买</a></div><{/if}>
		<{/capture}>
		<li class="goods-item fore<{$do}><{if $do % $setting.column == 0}> last<{/if}>">
		<div class="goods-inner">
		<{if $setting.imgside =='1'}>
		<div class="goods-info">
		<{$smarty.capture.goodsIntro}><{$smarty.capture.goodsname}><{$smarty.capture.goodsinfo}></div>
		<{if $setting.showgoodsImg!="off"}>
		<div class="goods-pic"><{$smarty.capture.goodsImg}><{$smarty.capture.goodstags}></div><{/if}><{elseif $setting.imgside =='2'}><{if $setting.showgoodsImg!="off"}><div class="goods-pic l"><{$smarty.capture.goodsImg}><{$smarty.capture.goodstags}></div><{/if}><div class="goods-info"><{$smarty.capture.goodsIntro}><{$smarty.capture.goodsname}><{$smarty.capture.goodsinfo}></div><{elseif $setting.imgside =='3'}><{if $setting.showgoodsImg!="off"}><div class="goods-pic r"><{$smarty.capture.goodsImg}><{$smarty.capture.goodstags}></div><{/if}><div class="goods-info"><{$smarty.capture.goodsIntro}><{$smarty.capture.goodsname}><{$smarty.capture.goodsinfo}></div><{else}><{if $setting.showgoodsImg!="off"}><div class="goods-pic"><{$smarty.capture.goodsImg}><{$smarty.capture.goodstags}></div><{/if}><div class="goods-info"><{$smarty.capture.goodsIntro}><{$smarty.capture.goodsname}><{$smarty.capture.goodsinfo}></div><{/if}></div></li><{assign var="do" value=$do+1}>
		<{/foreach}>
		
		
		</ul>
		
		</div>



<!--end
          	作者：sihua
          	时间：2017-04-20
          	描述：购物车和数量
          -->
<script>
bindQuantityEvent(focus_<{$widgets_id}>,setQuantity);
//== 为数量选择框绑定事件
function bindQuantityEvent(elements, callback) {
    elements = document.id(elements) || $$(elements);
    if(!elements && !elements.length) return;
    
    //= edit by hzk 每次点击的（加减）数量
	elements.addEvents({
		  //= 数量按钮
        ////////////////////////////////////
	  //= edit by hzk 每次点击的（加减）数量
	       'click:relay(.btn-decrease,.btn-increase)': function(e) {
	            var getPeradd = this.getParent().getElement('.action-quantity-input-getPeradd');
	            var input = this.getParent().getElement('.action-quantity-input');
	            
  	            perclicknum= parseInt((<{$data.add.isused}> ==1) ?  <{$data.add.pernum}>  : parseInt(getPeradd.value)) ;  
	            
	            value = +input.value;
	            
	            //add by hzk 2017-5-18
	            checknum=value+perclicknum;
	            checkmaxbuy(this, checknum,'button'); 
	            
	            
	            peradd = this.hasClass('btn-decrease') ? (value - perclicknum) : (value + perclicknum);
	            input.value = peradd - (peradd%perclicknum);
	            
	            callback && callback(input, value);
	        },        
         
        ////////////////////////////////////
        //= 数量输入框
        'focus:relay(.action-quantity-input)': function(e){
            value = +this.value;
        },
        'change:relay(.action-quantity-input)': function(e) {
        	checkmaxbuy(this, value,'text'); 
            callback && callback(this, value);
        }
    });
}

//== 赠品封顶值提示方法 add by hzk 2017-5-18
function checkmaxbuy(e1, value,inputtype) {
	
	//alert(1);
	 //add by hzk 2017-5-18
  var checkgift = e1.getParent().getElement('.action-quantity-input-havegift');	           
  	//alert(checkgift.value);   
  if('havegift'==checkgift.value){
	   var getmaxbuy = e1.getParent().getElement('.action-quantity-input-getmaxbuy');
 		// alert(getmaxbuy.value);   
      if(!e1.hasClass('btn-decrease')){  
      	
				if(inputtype=='button' && getmaxbuy.value == value){
					Dialog.alert('该商品购买数量已达赠品优惠上限'+getmaxbuy.value+'，上限之后的购买数量将不赠送赠品，确定继续购买？');
	            }else if(inputtype=='text' && getmaxbuy.value<=value){
					Dialog.alert('该商品仅在前'+getmaxbuy.value+'个商品赠送赠品，上限数量之后的购买数量将不赠送赠品，确定继续购买？');
	            }
		} 
  }
}

//== 获取商品数量值
function getQuantity(el, type) {
    return el.getElement('input[name=' + type + ']').value;
}
//== 设置商品数量
function setQuantity(input, value) {
    var type = 'product';
    var p = input.getParent('li');
    inputCheck(input, {min: input.get('min'), max: input.get('max'), 'default': value, store: getQuantity(p, 'stock'), callback: window.quantityCallback});
}
//== 商品数量输入框正确性检测
function inputCheck(input, options) {
    if(!input) return false;
    options = options || {};
    if(isNaN(options.min)) options.min = 1;
    if(isNaN(options.max)) options.max = 999999;
    options['default'] = options['default'] || options.min;
    var value = +input.value;
    var tips = new Tips(input);
    var pre = '';
    var msg = '';
    if(options.store && options.store - value <= 0) {
        pre = '库存有限，';
    }
    
    if(value < options.min) {
        input.value = options.min;
        msg = '此商品的最小购买数量为' + options.min + '件';
    }
    
    else if(value > options.max){
        input.value = options.max;
        msg = pre + '此商品最多只能购买' + options.max + '件';
    }
    
    else if(isNaN(value)) {
        input.value = options['default'];
        msg = '只允许输入数字';
    }
    if (msg) {
        tips.show(msg);
        return false;
    }
    tips.hide();
    if(options.callback) options.callback(input, options['default']);
    return true;
}
</script>